package cn.techwis.dto;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

@NoArgsConstructor
@Data
@Builder
@AllArgsConstructor
public class RefundsDTO {

    /**
     * 退款订单号
     */
    private String refund_id;
    /**
     * out_refund_no
     */
    private String out_refund_no;
    /**
     * 微信支付订单号
     */
    private String transaction_id;
    /**
     * 商户订单号
     */
    private String out_trade_no;
    /**
     * 退款渠道
     */
    private String channel;
    /**
     * 退款入账账户
     */
    private String user_received_account;
    /**
     * 退款成功时间
     */
    private String success_time;
    /**
     * 退款创建时间
     */
    private String create_time;
    /**
     * 退款状态 SUCCESS：退款成功
     * CLOSED：退款关闭
     * PROCESSING：退款处理中
     * ABNORMAL：退款异常
     */
    private String status;
    /**
     * 资金账户 UNSETTLED : 未结算资金
     * AVAILABLE : 可用余额
     * UNAVAILABLE : 不可用余额
     * OPERATION : 运营户
     */
    private String funds_account;
    /**
     * +金额信息
     */
    private PayNotifyDTO.AmountVO amount;
    /**
     * +优惠退款信息
     */
    private List<PayNotifyDTO.PromotionDetailVO> promotion_detail;

    @NoArgsConstructor
    @Data
    @AllArgsConstructor
    @Builder
    public static class AmountVO {
        /**
         * 订单金额
         */
        private int total;
        /**
         * 退款金额
         */
        private int refund;
        /**
         * 用户支付金额
         */
        private int payer_total;
        /**
         * 用户退款金额
         */
        private int payer_refund;
        /**
         * 应结退款金额
         */
        private int settlement_refund;
        /**
         * 应结订单金额
         */
        private int settlement_total;
        /**
         * 优惠退款金额
         */
        private int discount_refund;
        /**
         * 退款币种
         */
        private String currency;
    }

    @NoArgsConstructor
    @Data
    @AllArgsConstructor
    @Builder
    public static class PromotionDetailVO {

        /**
         * 券ID
         */
        private String promotion_id;
        /**
         * 优惠范围
         */
        private String scope;
        /**
         * 优惠类型
         */
        private String type;
        /**
         * 优惠券面额
         */
        private int amount;
        /**
         * 优惠退款金额
         */
        private int refund_amount;
        /**
         * +商品列表
         */
        private List<PayNotifyDTO.PromotionDetailVO.GoodsDetailVO> goods_detail;

        @NoArgsConstructor
        @Data
        @AllArgsConstructor
        @Builder
        public static class GoodsDetailVO {

            /**
             * 商户侧商品编码
             */
            private String merchant_goods_id;
            /**
             * 微信侧商品编码
             */
            private String wechatpay_goods_id;
            /**
             * 商品名称
             */
            private String goods_name;
            /**
             * 商品单价
             */
            private int unit_price;
            /**
             * 商品退款金额
             */
            private int refund_amount;
            /**
             * 商品退货数量
             */
            private int refund_quantity;
        }
    }
}
